import { fetch, oss } from '@/utils/fetch.js';

// 课程管理课程列表
export function getCourseList(params) {
  return fetch({
    url: '/questionlib/nice/course/list',
    method: 'POST',
    data: params,
  });
}

// 设置讲次列表
export function courseLessonList(params) {
  return fetch({
    url: '/questionlib/nice/courseLesson/list',
    method: 'POST',
    data: params,
  });
}
// 获取教辅书列表
export function referenceLibsearch(params) {
  return fetch({
    url: '/usercenter/operation/referenceLib/search',
    method: 'POST',
    data: params,
  });
}

// 一键关联
export function associateVolumeWithCourse(params) {
  return fetch({
    url: '/usercenter/operation/course/associateVolumeWithCourse',
    method: 'POST',
    data: params,
  });
}

// 排课列表
export function coursePeriodList(params) {
  return fetch({
    url: '/questionlib/nice/coursePeriod/list',
    method: 'POST',
    data: params,
  });
}

// 删除排课
export function deleteCourse(params) {
  return fetch({
    url: '/questionlib/nice/courseLesson/delete',
    method: 'POST',
    data: params,
  });
}

// 根据id查询课期数据
export function coursePeriodDetail(params) {
  return fetch({
    url: '/questionlib/nice/coursePeriod/detail',
    method: 'POST',
    data: params,
  });
}

// 设置讲次详情
export function courseLessonDetail(params) {
  return fetch({
    url: '/questionlib/nice/courseLesson/detail',
    method: 'POST',
    data: params,
  });
}

// 课程列表-根据课程id获取课程信息
export function getCourseById(params) {
  return fetch({
    url: '/usercenter/core/tableRecord/queryOne',
    method: 'POST',
    data: params,
  });
}
// 排课-列表
export function queryAutoSqlList(params) {
  return fetch({
    url: '/usercenter/core/tableRecord/queryAutoSqlList',
    method: 'POST',
    data: params,
  });
}
// 排课-列表改
export function periodList(params) {
  return fetch({
    url: '/usercenter/operation/course/periodList',
    method: 'POST',
    data: params,
  });
}

// 新增课期
export function coursePeriodInsert(params) {
  return fetch({
    url: '/questionlib/nice/coursePeriod/insert',
    method: 'POST',
    data: params,
  });
}
// 更新课期
export function coursePeriodUpdate(params) {
  return fetch({
    url: '/questionlib/nice/coursePeriod/update',
    method: 'POST',
    data: params,
  });
}

// 课时定价列表
export function qryCoursePriceDetails(params) {
  return fetch({
    url: '/questionlib/course/qryCoursePriceDetails',
    method: 'POST',
    data: params,
  });
}

// 保存定价值
export function updateCoursePricing(params) {
  return fetch({
    url: '/questionlib/course/updateCoursePricing',
    method: 'POST',
    data: params,
  });
}
// 课程定价新增定价类型（教师等级）
export function insertTeacherPrice(params) {
  return fetch({
    url: '/questionlib/nice/coursePrice/insertTeacherPrice',
    method: 'POST',
    data: params,
  });
}

// 课程定价新增定价类型（初始价格）
export function insertTypePrice(params) {
  return fetch({
    url: '/questionlib/nice/coursePrice/insertTypePrice',
    method: 'POST',
    data: params,
  });
}

// 课程定价新增定价类型（学段类型）
export function insertStagePrice(params) {
  return fetch({
    url: '/questionlib/nice/coursePrice/insertStagePrice',
    method: 'POST',
    data: params,
  });
}

// 获取课程列表枚举
export function courseListEunm(params) {
  return fetch({
    url: '/questionlib/nice/courseList/eunm',
    method: 'POST',
    data: params,
  });
}

// 拖动更改排课顺序
export function tableSort(params) {
  return fetch({
    url: '/usercenter/nice/common/sort',
    method: 'POST',
    data: params,
  });
}
// 根据id获取课期数据
export function queryAutoSqlOne(params) {
  return fetch({
    url: '/usercenter/core/tableRecord/queryAutoSqlOne',
    method: 'POST',
    data: params,
  });
}

// 上传课件
export function courseWareupload(params) {
  return fetch({
    url: '/questionlib/nice/courseWare/upload',
    method: 'POST',
    data: params,
  });
}

// 上传素材
export function materialUpload(params) {
  return fetch({
    url: '/questionlib/nice/material/upload',
    method: 'POST',
    data: params,
  });
}
// 课程定价删除定价类型
export function deleteTypePrice(params) {
  return fetch({
    url: '/usercenter/operation/coursePrice/deleteTypePrice',
    method: 'POST',
    data: params,
  });
}

// 课程定价删除年纪类型
export function deleteStagePrice(params) {
  return fetch({
    url: '/usercenter/operation/coursePrice/deleteStagePrice',
    method: 'POST',
    data: params,
  });
}

// 获取课时的作业列表（网校后台预览课件时获取各作业的题目列表）
export function getListQuestion(params) {
  return fetch({
    url: '/usercenter/operation/course/listQuestion',
    method: 'POST',
    data: params,
  });
}

//根据题卷id获取试卷的题目列表(课程的题目预览调用或者查看题卷详情时调用)
export function getListQuestionsByVolumeId(params) {
  return fetch({
    url: '/usercenter/operation/netSchool/homework/listQuestionsByVolumeId',
    method: 'POST',
    data: params,
  });
}
//获取课时题卷id
export function getWorkId(params) {
  return fetch({
    url: '/usercenter/operation/school/getWorkId',
    method: 'POST',
    data: params,
  });
}

// 课程定价删除教师类型
export function deleteTeacherPrice(params) {
  return fetch({
    url: '/usercenter/operation/coursePrice/deleteTeacherPrice',
    method: 'POST',
    data: params,
  });
}

// 更新课时-无课件id时
export function updateWithoutCourseWareId(params) {
  return fetch({
    url: '/questionlib/nice/lesson/updateWithoutCourseWareId',
    method: 'POST',
    data: params,
  });
}

// 更新2-有课件id时
export function lessonUpdate(params) {
  return fetch({
    url: '/questionlib/nice/lesson/update',
    method: 'POST',
    data: params,
  });
}

// 删除课期
export function lessonDelete(params) {
  return fetch({
    url: '/usercenter/operation/course/lessonDelete',
    method: 'POST',
    data: params,
  });
}

// 讲次模板下载
export function downloadTemplateFile(params) {
  return fetch({
    url: '/questionlib/bussiness/userMangement/downloadTemplateFile',
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}
// 讲次批量导入
export function importData(params, type) {
  return oss({
    baseUrl: '/questionlib/bussiness/userMangement/importData',
    method: 'POST',
    data: params,
    type: type,
  });
}

// 调整课的时间
export function adjustment(params) {
  return fetch({
    url: '/usercenter/operation/periodLesson/adjustment',
    method: 'POST',
    data: params,
  });
}

// 获取老师所有时间
export function taskInstanceList(params) {
  return fetch({
    url: '/usercenter/operation/teacher/taskInstanceList',
    method: 'POST',
    data: params,
  });
}

// 删除课程
export function courseDelete(params) {
  return fetch({
    url: '/usercenter/operation/course/deleteCourseById',
    method: 'POST',
    data: params,
  });
}

//  调整发布状态发布
export function coursePeriodPublish(params) {
  return fetch({
    url: '/usercenter/operation/coursePeriod/publish',
    method: 'POST',
    data: params,
  });
}
// 调整发布状态关闭
export function coursePeriodClose(params) {
  return fetch({
    url: '/usercenter/operation/coursePeriod/close',
    method: 'POST',
    data: params,
  });
}
// 删除期次
export function coursePeriodDelete(params) {
  return fetch({
    url: '/usercenter/operation/coursePeriod/delete',
    method: 'POST',
    data: params,
  });
}

// 发布课程
export function coursePublishOn(params) {
  return fetch({
    url: '/usercenter/operation/course/publish',
    method: 'POST',
    data: params,
  });
}

// 关闭课程
export function closeCourse(params) {
  return fetch({
    url: '/usercenter/operation/course/close',
    method: 'POST',
    data: params,
  });
}

// 获取课节总数
export function getLessonNum(params) {
  return fetch({
    url: '/questionlib/nice/course/getLessonNum',
    method: 'POST',
    data: params,
  });
}

// 更新课程
export function updateCourse(params) {
  return fetch({
    url: '/usercenter/operation/course/updateCourse',
    method: 'POST',
    data: params,
  });
}

// 更新回放url
export function updateLiveBackWatchUrl(params) {
  return fetch({
    url: '/usercenter/operation/live/updateLiveBackWatchUrl',
    method: 'POST',
    data: params,
  });
}

// 获取全部老师
export function getAllLecturer(params) {
  return fetch({
    url: '/usercenter/operation/course/getAllLecturer',
    method: 'POST',
    data: params,
  });
}
